Disable AndroidEnableMarshalMethods to fix silent startup crash - #204
Merged
Conversation
… logs AndroidEnableMarshalMethods=true generates build-time P/Invoke stubs that can crash in native code when combined with profiled AOT + trimming. The crash bypasses managed exception handling, producing no crash logs — matching the reported symptoms (black screen, rotated screen, silent crash). The default runtime-generated P/Invoke trampolines are used instead. Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/900d2a81-5771-4a37-ab0c-f6d9bf79386e Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
winnerspiros
April 19, 2026 07:31
View session
There was a problem hiding this comment.
Pull request overview
Disables build-time generated P/Invoke marshal stubs on .NET 10 Android to avoid silent native startup crashes when using profiled AOT + trimming, reverting to the runtime-generated trampolines.
Changes:
- Set
AndroidEnableMarshalMethodstofalseinosu.Android.props. - Replace the previous performance-focused comment with a crash-risk explanation specific to profiled AOT + trimming.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After the
EnableLLVMfix (PR #203), the APK still crashes on startup — black screen, screen rotates to landscape, then dies with no crash logs.The absence of managed exception output is the key signal:
AndroidEnableMarshalMethods=truegenerates build-time P/Invoke stubs that execute in native code, bypassing managed exception handling entirely. When combined with profiled AOT + trimming, the generated stubs can produce invalid native calls (silent SIGSEGV/SIGABRT).AndroidEnableMarshalMethods=falseinosu.Android.props— reverts to runtime-generated P/Invoke trampolines which handle partial AOT correctlyThe crash timeline matches:
LoadComplete()fires the first P/Invoke (nGetBigCoreMask/nSetThreadAffinity) after orientation is applied — consistent with "black screen → rotation → crash" sequence. The ~5-10% P/Invoke overhead is negligible since hot-path audio usesUnmanagedCallersOnlyfunction pointers, notDllImport.